package com.nidu.demo.oauth2;

import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.nidu.demo.oauth2.dto.OAuth2RefreshTokenPageQry;
import com.nidu.demo.oauth2.api.OAuth2RefreshTokenService;
import com.nidu.demo.oauth2.dto.OAuth2RefreshTokenCO;
import com.nidu.demo.oauth2.executor.command.OAuth2RefreshTokenDeleteCmdExe;
import com.nidu.demo.oauth2.executor.query.OAuth2RefreshTokenPageQryExe;
import com.nidu.demo.oauth2.executor.query.OAuth2RefreshTokenSingleQryExe;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Set;

@Service
@RequiredArgsConstructor
public class OAuth2RefreshTokenServiceImpl implements OAuth2RefreshTokenService {

    private final OAuth2RefreshTokenDeleteCmdExe deleteCmdExe;
    private final OAuth2RefreshTokenSingleQryExe singleQryExe;
    private final OAuth2RefreshTokenPageQryExe pageQryExe;

    @Override
    public Response delete(Long id) {
        return deleteCmdExe.execute(id);
    }

    @Override
    public Response delete(Set<Long> ids) {
        return deleteCmdExe.execute(ids);
    }

    @Override
    public SingleResponse<OAuth2RefreshTokenCO> getById(Long id) {
        return singleQryExe.execute(id);
    }

    @Override
    public PageResponse<OAuth2RefreshTokenCO> page(OAuth2RefreshTokenPageQry pageQry) {
        return pageQryExe.execute(pageQry);
    }
}
